extends "../rangbaer-2/rangbaer-2.gd"

func _extInit():
	._extInit()
	lv = 3             #等级的设置
	addSkill("炮击有0.4%几率夺取目标身上的一件装备<限定>，回合结束时，提高自身装备属性1%", "海盗之魂")
#掠夺触发概率
var p3 = 4
#装备提高属性比例
var p3_2 = 1.01

var sk3Flag = true
func _onBattleEnd():
	._onBattleEnd()
	sk3Flag = true
	if sys.rndPer(100):
		for i in items:
			strengthenEquip(i)

func _onNormalAtk(cha):
	._onNormalAtk(cha)
	if team == 1 and not cha.isSumm and not cha.items.empty():
		var n = sys.rndRan(0, 1000)
		if sk3Flag and n <= p3:
			sk3Flag = false
			utils.createSkillTextEff("抢夺装备", position)
			yield(reTimer(0.1),"timeout")
			var it = cha.items[0]
			sys.main.player.addItem(sys.newItem(it.id))
			it.delFromCha()
		
func strengthenEquip(item):
	item.att.maxHp *= p3_2
	item.att.atk *= p3_2
	item.att.mgiAtk *= p3_2
	item.att.atkRan *= p3_2
	item.att.def *= p3_2
	item.att.cri *= p3_2
	item.att.criR *= p3_2
	item.att.suck *= p3_2
	item.att.mgiSuck *= p3_2
	item.att.reHp *= p3_2
	item.att.spd *= p3_2
	item.att.dod *= p3_2
	item.att.air *= p3_2